package com.ideal.frame.sys.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.ideal.frame.entity.BaseAutoModel;
import lombok.Data;
import org.hibernate.annotations.Proxy;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

@Data
@Entity
@Table(name = "t_sys_menu")
@Proxy(lazy = false)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class SysMenu extends BaseAutoModel {
    private String menuName;
    private Integer sort;
    private String href;
    private String menuIcon;
    private String menuType;
    @Column(name = "is_show")
    private Boolean show;
    private String permission;
    private Long parentId;

    @Transient
    private List<Long> levels;

    public SysMenu() {
    }

    public SysMenu(Long id) {
        super(id);
    }

    public Long getParentId() {
        return this.parentId == null ? 0l : this.parentId;
    }
}
